package client;

import com.jme3.math.Vector3f;
import com.jme3.network.AbstractMessage;
import com.jme3.network.serializing.Serializable;

/**
 *
 * @author Ben
 * Purpose: Definitions for network messages for the spidermonkey api
 */
public class NetMessages
{
    /*
    chatMessage:
    defines the chatMessage message (packet-style used by the spidermonkey api)
    used for sending text based messages backwards and forwards
    */
    @Serializable
    public static class ChatMessage extends AbstractMessage
    {
        public String text;
        public ChatMessage()
        {
        }
        public ChatMessage(String text)
        {
            this.text = text;
        }
    }
    @Serializable
    public static class MovePacket extends AbstractMessage
    {
        public Vector3f move;
        public Vector3f lagmove;
        public boolean dolag;
        public int idd;
        public MovePacket()
        {
            
        }
        public MovePacket(Vector3f inmove, int ping, boolean dolag, int id)
        {
            lagmove = move.interpolate(move, ping);
            this.idd = id;
            if(!dolag)
            {
                this.move = inmove;
            }
            else
            {
                this.move = lagmove;
            }
        }
    }
}
